﻿@model IEnumerable<orienta.Helper.DependenciaInfo>
@{
    Layout = "~/Views/Shared/_LayoutPopUpTree.cshtml";
    ViewBag.Title = "Index";
    var id = 0;
}
<script src="@Url.Content("~/js/midis.js")" type="text/javascript"></script>

<form id="form_lupita">


<script language="javascript" type="text/javascript">
    d = new dTree('d');
    d.add(0, -1, 'Dependencias', '', 'Dependencias', '', '..images/trees/base.gif', '../images/trees/base.gif'); 
   
@foreach (var item in Model)
{
    id = id + 1;
 decimal? padre= @item.IdDepPadre;
   if (padre == null)
   {
       padre = 0;
   }
   if (padre == 0)
   {
    @:d.add(@item.IdDep,@padre, '@item.DescDep <@String.Format("{0:0000}", item.IdDep)>', '', '@item.DescDep', '', '../images/trees/folder.gif', '../images/trees/folderopen.gif');
   }
   else { 
    @:d.add(@item.IdDep,@padre, '@item.DescDep <@String.Format("{0:0000}", item.IdDep)><input type=radio id="seleccionado" name="seleccionado[]" onclick="javascript:seleccionarDependencia(this)" value="@item.DescDep <@String.Format("{0:0000}", item.IdDep)-A>" size="1">', '', '@item.DescDep', '', '../images/trees/folder.gif', '../images/trees/folderopen.gif');
   }
}
   
    document.write(d); d.openTo(1, true); d.s(0); 
</script>
</form>